<template>
  <div id="centerRight1">
    <div class="bg-color-black">
      <div class="d-flex pt-2 pl-2">
        <span>
          <icon name="chart-line" class="text-icon"></icon>
        </span>
        <div class="d-flex">
          <span class="fs-xl text mx-2" @click="button" style="font-size: 15px">境外输入累计确诊省Top10</span>
        </div>
      </div>
      <div class="d-flex jc-center body-box">
        <dv-scroll-board class="dv-scr-board" :config="config"/>
      </div>
    </div>
  </div>
</template>

<script>
import {gettop} from "@/axios/api";

export default {
  data() {
    return {
      config: {
        // '例数'
        header: ['日期', '省份', '例数'],
        data: [],
        rowNum: 7, //表格行数
        headerHeight: 35,
        headerBGC: '#0f1325', //表头
        oddRowBGC: '#0f1325', //奇数行
        evenRowBGC: '#171c33', //偶数行
        index: true,
        columnWidth: [50],
        align: ['center']
      }
    }
  },
  mounted() {
    this.getTop()
  },
  methods: {
    button() {
      this.$confirm('是否前往全国疫情？', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        window.open("https://voice.baidu.com/act/newpneumonia/newpneumonia/?from=osari_aladin_banner#tab1");
      })
    },
    async getTop() {
      var data = []
      let top = await gettop().then(res => res.data)
      for (var i = 0; i < top.length; i++) {
        data[i] = ([top[i][0],top[i][1],"<span  class='colorRed'>" + top[i][2] + "</span>"])
      }
      console.log(data)
      this.config = {
        // '例数'
        header: ['日期', '省份', '例数'],
        data: data,
        rowNum: 7, //表格行数
        headerHeight: 35,
        headerBGC: '#0f1325', //表头
        oddRowBGC: '#0f1325', //奇数行
        evenRowBGC: '#171c33', //偶数行
        index: true,
        columnWidth: [50],
        align: ['center']
      }
    }
  }
}
</script>

<style lang="scss" scoped>
$box-height: 410px;
$box-width: 425px;
#centerRight1 {
  padding: 20px;
  padding-top: 20px;
  height: $box-height;
  width: $box-width;
  border-radius: 5px;

  .bg-color-black {
    height: $box-height - 30px;
    border-radius: 10px;
  }

  .text {
    color: #c3cbde;
  }

  .body-box {
    border-radius: 10px;
    overflow: hidden;

    .dv-scr-board {
      width: 350px;
      height: 340px;
    }
  }
}
</style>
